package com.baizan.daka.util

import java.text.ParsePosition
import java.text.SimpleDateFormat

class TimeUtil {

    companion object{

        /**
         * Timestamp to String
         * @param Timestamp
         * @return String
         */
        fun transToString(time:Long):String{
            return SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time)
        }

        /**
         * String to Timestamp
         * @param String
         * @return Timestamp
         */

        fun transToTimeStamp(date:String):Long{
            return SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date, ParsePosition(0)).time
        }

        /**
         * Timestamp to String
         * @param Timestamp
         * @return String
         */
        fun transToYMdHm(time:Long):String{
            return SimpleDateFormat("yyyy-MM-dd HH:mm").format(time)
        }
        fun transToYMd(time:Long):String{
            return SimpleDateFormat("yyyy-MM-dd").format(time)
        }
    }

}